/**
 * 
 */
package smallChanges.Tokenization;

import smallChanges.util.SCConstants;


/**
 * @author jspacco
 *
 */
public class UniqueToken
{
    private Long uniqueTokenID;
    private String image;
    private String kind;
    
    public UniqueToken() {}
    
    
    
    public boolean equals(Object o)
    {
        if (!(o instanceof UniqueToken))
            return false;
        if (o==null)
            return false;
        UniqueToken other=(UniqueToken)o;
        
        return 
        ((this.uniqueTokenID == other.uniqueTokenID) ||
            (this.uniqueTokenID!=null && this.uniqueTokenID.equals(other.uniqueTokenID))
            ) &&
        this.getImage() !=null &&
        other.getImage() != null &&
        this.getImage().equals(other.getImage()) &&
        this.kind != null &&
        this.kind.equals(other.kind);
    }
    
    public Long getUniqueTokenID()
    {
        return uniqueTokenID;
    }
    public void setUniqueTokenID(Long uniqueTokenID)
    {
        this.uniqueTokenID = uniqueTokenID;
    }
    public String getImage()
    {
        return image;
    }
    public void setImage(String image)
    {
        // XXX capping the maximum image of a token at 2048 characters
        // this is necessary because literal string tokens can get somewhat huge
        if (image.length() > SCConstants.MAX_TOKEN_IMAGE_LENGTH) {
            image=image.substring(0, SCConstants.MAX_TOKEN_IMAGE_LENGTH);
        }
        this.image = image;
    }
    public String getKind()
    {
        return kind;
    }
    public void setKind(String kind)
    {
        this.kind = kind;
    }
    
}
